<template>
 <div class="box">
        <header class="header">
          <van-nav-bar
        title="用户"
       
        left-arrow
        @click-left="$router.back()"
      />
        </header>
        <div class="content">
          <div class="user">
             <p>用户名:{{username}}</p>
           <van-button type="primary" @click="loginout">退出登录</van-button>
          </div>
        </div>
     </div>
   
</template>

<script setup>

const username = localStorage.getItem('username')
import { useRouter } from 'vue-router'
const router = useRouter()
const loginout=()=>{
   localStorage.removeItem('token')
   localStorage.removeItem('username')
   router.push('/login')
}
</script>

<style lang="scss" scoped>
.user{
   display: flex;
   justify-content: space-between;
}
</style>